翻訳と辞書
Words near each other
・ swap file
・ swap space
・ swapped in
・ swapped out
・ swapping
・ sweetlambda
・ swf
・ swi-prolog
・ swing
・ switch
switch statement
・ switched multimegabit data service
・ switched virtual circuit
・ switched virtual connection
・ switching
・ switching hub
・ swizzle
・ swl
・ swt
・ swung dash


Dictionary Lists
翻訳と辞書 辞書検索 [ 開発暫定版 ]
スポンサード リンク

switch statement : FOLDOC
switch statement
(Or case statement, multi-way branch) A construct found in most high-level languages for selecting one of several possible blocks of code or branch destinations depending on the value of an expression. An example in C is
switch (foo(x, y))
{
case 1: printf("Hello case 2: printf("Goodbye">n"); /* fall through */
case 2: printf("Goodbye
n"); break;
case 3: printf("Fish default: fprintf(stderr, "Odd foo value">n"); break;
default: fprintf(stderr, "Odd foo value
n"); exit(1);
}

The break statements cause execution to continue after the whole switch statemetnt. The lack of a break statement after the first case means that execution will fall through into the second case. Since this is a common programming error you should add a comment if it is intentional.
If none of the explicit cases matches the expression value then the (optional) default case is taken.
A similar construct in some functional languages returns the value of one of several expressi


スポンサード リンク
翻訳と辞書 : 翻訳のためのインターネットリソース

Copyright(C) kotoba.ne.jp 1997-2016. All Rights Reserved.